package com.xueqiu.movieplaymanagersystem.utils.sensitiveUtils;

import java.io.Serializable;
import java.util.TreeSet;

/**
 * 敏感词节点；单向节点；节点包含，所有以相同的2个字符开头的，敏感词
 *
 * @author xueqiu
 */
public class SensitiveNode implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 头两个字符的mix。mix相同，两个字符相同
     */
    protected final int headTwoCharMix;

    /**
     * 所有以headTwoCharMix开头的，敏感词，存放的地方
     */
    protected final TreeSet<StringPointer> words = new TreeSet<>();

    /**
     * 下一个节点
     */
    protected SensitiveNode next;

    public SensitiveNode(int headTwoCharMix) {
        this.headTwoCharMix = headTwoCharMix;
    }

    public SensitiveNode(int headTwoCharMix, SensitiveNode parent) {
        this.headTwoCharMix = headTwoCharMix;
        parent.next = this;
    }

}
